package Method;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import Model.DataConnect;
import Model.card2;

public class Statistics {

	/**
	 * @param args
	 */
	private String date ;
	ArrayList<card2>cards = new ArrayList<card2>();
	public ArrayList<card2> Statistics(String date,	ArrayList<card2>cards) throws SQLException, ClassNotFoundException{
		this.date = date;
		this.cards = cards;
		String sql ="select * from card where ntime like '"+date+"'";
		ResultSet rs = DataConnect.getStatement().executeQuery(sql);
		while(rs.next()){
			cards.add(new card2(rs.getString(1),rs.getString(2),rs.getTimestamp(3),rs.getString(4),rs.getString(5)));
			
		}
		
		for(int i = 0;i<cards.size();i++){
			
			 cards.get(i).getuid();
			 cards.get(i).getuname();
			 cards.get(i).getToday();
			 cards.get(i).getuip();
			 cards.get(i).getState();
			 
		}
		return cards;
		
	}
//	public static void main(String[] args) throws SQLException, ClassNotFoundException {
//		// TODO Auto-generated method stub
//
//		new Statistics();
//	}

}
